function getRootPath(){
	 var pathName = window.location.pathname.substring(1);
//	 var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
//	 var path_root = window.location.protocol + '//' + window.location.host + '/';
	 var path_root = window.location.protocol + '//' + window.location.host + '/fg/';
	 return path_root;
}

function alertInfo(id,msg){
	$("#"+id).show();
	$("#"+id+"X").show();
	$("#msg").html(msg);
}

function closeAlert(id){
	$("#"+id).hide();
	$("#"+id+"X").hide();
}

//深浅汉字转换
function rate(g){
	let res = "-";
	if(g.THEMINUROWIN >=5 || g.THEMINUROLOS <=-5){
		res = "主浅(客深)";
	}else if(g.THEMINUROLOS >= 5 || g.THEMINUROWIN <= -5){
		res = "主深(客浅)";
	}else {
		res = "正常";
	}
	return res;
}

function goalh(g){
	if(g.GOALS_H==undefined || g.GOALS_H.trim().length===0){
		return '-';
	}else{
		return g.GOALS_H;
	}
}
function goalc(g){
	if(g.GOALS_C==undefined || g.GOALS_C.trim().length===0){
		return '-';
	}else{
		return g.GOALS_C;
	}
}

function status(g){
	let status = g.STATUS;
	if(status == null || status == undefined || status==""){
		return "-";
	}else{
		return status*2.5;
	}
}
function statusx(g){
	let status = g.STATUS;
	if(status !='' && status != undefined && status != null){
		if(status >= 4){
			return "主优";
		}else if(-4<status && status<4){
			return "相当";
		}else{
			return "客优";
		}
	}else{
		return "-";
	}
	
}

function showDetail(id){
	if($("#"+id).next().css("display")=="table-row"){
		$("#"+id).next().css("display","none");
	}else{
		$("#"+id).next().css("display","");
	}
}

function hist(g){
	let hhist = g.H_G_HIST;
	let chist = g.C_G_HIST;
	if(hhist != undefined && chist!=undefined){
		if(hhist.trim() == '' || chist.trim()==''){
			return "-";
		}else{
			if(hhist>chist){
				return "主优";
			}else if(hhist==chist){
				return "相当";
			}else if(chist>hhist){
				return "客优";
			}
		}
	}
}

function strength(g){
	let difference = g.STRENTH_DIFFERENCE;
	if(difference != "" && difference != undefined){
		if(difference >= 40){
			return "主强";
		}else if(difference > -40 && difference <40){
			return "相当";
		}else{
			return "客强";
		}
	}
}

function abetratewin(g){
	let win = g.A_BET_LOSERATE_WIN;
	let lose = g.A_BET_LOSERATE_LOST;
	let dif = (200-win*100-lose*100)/200;
	let res = (dif*100 + win*100)/100;
	return res;
}

function abetratelose(g){
	let win = g.A_BET_LOSERATE_WIN;
	let lose = g.A_BET_LOSERATE_LOST;
	return ((200-win*100-lose*100)/2 + lose*100)/100;
}

function utheory(v){
	if(null != v && undefined != v){
		let val = 100/v;
		return Math.floor(val*100)/100;
	}
}